<?php

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');
//echo 'view top ok';
/**
 * View class 
 */
class TaxiBookingViewOrders extends JView {

	function display($tpl=null)
	{


		global $mainframe, $option;
//$mainframe = &JFactory::getApplication();
		//initialise variables
		$user 		= & JFactory::getUser();
		$db  		= & JFactory::getDBO();
		$document	= & JFactory::getDocument();
		$lang 		= & JFactory::getLanguage();

		JHTML::_('behavior.tooltip');

		//get vars
//		$filter_order		= $mainframe->getUserStateFromRequest( $option.'.orders.filter_order', 		'filter_order', 	'datetime1', 'cmd' );
//
//		$filter_order_Dir	= $mainframe->getUserStateFromRequest( $option.'.orders.filter_order_Dir',	'filter_order_Dir',	'ASC', 'word' );
//		$filter_state 		= $mainframe->getUserStateFromRequest( $option.'.orders.filter_state', 		'filter_state', 	'*', 'word' );
//                $filter_payment		= $mainframe->getUserStateFromRequest( $option.'.orders.filter_payment', 		'filter_payment', 	'*', 'word' );
//		$search 		= $mainframe->getUserStateFromRequest( $option.'.orders.search', 			'search', 			'', 'string' );
//		$search 		= $db->getEscaped( trim(JString::strtolower( $search ) ) );

		//add css and submenu to document
		$document->addStyleSheet('components/com_taxibooking/assets/css/bookingbackend.css');

//echo 'ok';
		//Create Submenu
		JSubMenuHelper::addEntry( JText::_( 'HOME' ), 'index.php?option=com_taxibooking');
		JSubMenuHelper::addEntry( JText::_( 'ITEMS' ), 'index.php?option=com_taxibooking&view=orders', true);
                JSubMenuHelper::addEntry( JText::_( 'INTEREST_POINTS' ), 'index.php?option=com_taxibooking&view=points');
                JSubMenuHelper::addEntry(JText::_( 'ROUTES' ), 'index.php?option=com_taxibooking&view=routes');
                JSubMenuHelper::addEntry( JText::_( 'COUNTYS' ), 'index.php?option=com_taxibooking&view=countys');
                JSubMenuHelper::addEntry( JText::_( 'DISTRICTS' ), 'index.php?option=com_taxibooking&view=districts');
		JSubMenuHelper::addEntry( JText::_( 'SETTINGS' ), 'index.php?option=com_taxibooking&view=settings');

		//create the toolbar
		JToolBarHelper::title( JText::_( 'ITEMS' ), 'generic' );

		//Get data from the model
		$rows      	= & $this->get( 'Data');
//                echo 'view ok';
		$pageNav 	= & $this->get( 'Pagination' );

                $lists = array ();

                $state = array ();
		$state[] = JHTML::_('select.option',  '', '- '. JText::_( 'Select State' ) .' -' );
		$state[] = JHTML::_('select.option',  'P', JText::_( 'Accepted' ) );
		$state[] = JHTML::_('select.option',  'U', JText::_( 'Rejected ' ) );
		$state[] = JHTML::_('select.option',  'A', JText::_( 'Archived' ) );
		$state[] = JHTML::_('select.option',  'W', JText::_( 'Waiting' ) );

		$lists['state'] = JHTML::_('select.genericlist',   $state, 'filter_state', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_state );

                $payment_methods = array ();
                $payment_methods[] = JHTML::_('select.option',  '', '- '. JText::_( 'Select Payment' ) .' -' );
		$payment_methods[] = JHTML::_('select.option',  'cash', JText::_( 'Cash' ) );
                $payment_methods[] = JHTML::_('select.option',  'paypal_confirmed', JText::_( 'Paypal (Confirmed)' ) );
                $payment_methods[] = JHTML::_('select.option',  'paypal_notconf', JText::_( 'Paypal (Not Confirmed)' ) );

		$lists['payment'] = JHTML::_('select.genericlist',   $payment_methods, 'filter_payment', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_payment );


		// search filter
		$lists['search']= $search;

		// table ordering
		$lists['order_Dir'] = $filter_order_Dir;
		$lists['order'] = $filter_order;

		$ordering = ($lists['order'] == 'id');

		//assign data to template
		$this->assignRef('lists'      	, $lists);
		$this->assignRef('rows'      	, $rows);
		$this->assignRef('pageNav' 		, $pageNav);
		$this->assignRef('ordering'		, $ordering);
		$this->assignRef('user'			, $user);
		$this->assignRef('direction'	, $lang);

		parent::display();
	}
}
?>